﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TibcoQueueMonitor.Entities
{
    /// <summary>
    /// Represents an EMS Server Profile
    /// </summary>
    [Serializable]
    public class EmsServerProfile : IEquatable<EmsServerProfile>
    {
        #region Private Fields
        private string _profileName;
        private string _hostname;
        private string _port;
        private string _user;
        private string _password;

        #endregion //Private Fields

        #region Public Properties
        public string ProfileName
        {
            get { return _profileName; }
            set { _profileName = value; }
        }

        public string Hostname
        {
            get { return _hostname; }
            set { _hostname = value; }
        }

        public string Port
        {
            get { return _port; }
            set { _port = value; }
        }

        public string User
        {
            get { return _user; }
            set { _user = value; }
        }

        public string Password
        {
            get { return _password; }
            set { _password = value; }
        }

        public string ProfileDisplayName
        {
            get { return String.Format("{0} ({1})", this.ProfileName, this.Hostname); }
        }

        #endregion //Public Properties

        #region IEquatable<EmsServerProfile>
        /// <summary>
        /// Equalses the specified other.
        /// </summary>
        /// <param name="other">The other.</param>
        /// <returns>
        /// <c>true</c>if either this profile's name or display name is equal
        /// to the other's profile name.
        /// </returns>
        public bool Equals(EmsServerProfile other)
        {
            return (this.ProfileName == other.ProfileName ||
                this.ProfileDisplayName == other.ProfileName);
        }

        #endregion IEquatable<EmsServerProfile>
    }
}
